package com.lixingqu.mvpdemo.net;

import com.lixingqu.mvpdemo.entity.HttpResultEntity;

import rx.functions.Func1;

/**
 * Created by lixingqu on 2016/12/2.
 */

public class HttpResultFunc<T> implements Func1<HttpResultEntity<T>,T> {
    @Override
    public T call(HttpResultEntity<T> tHttpResultEntity) {
        if (!tHttpResultEntity.getCode().equals("200")){
            throw new RuntimeException("错误码："+tHttpResultEntity.getCode());
        }
        return tHttpResultEntity.getNewslist();
    }
}
